<template>
	<view>
		<view class="qrcode">
			<view class="cui_erweima">
				<image :src="name"  style="width: 200px;height: 200px;"></image>
			</view>
		</view>
		<view class="title">
			我的二维码
		</view>
	</view>
</template>

<script>
	const qrCode = require('@/comps/weapp-qrcode.js')
	export default {
		data() {
			return {
				myname:'',
				name:''
			}
		},
		onLoad() {
			this.myname = uni.getStorageSync('name')
			this.name = "http://121.36.45.234/uploads/qrcode/"+this.myname+"_hs.jpg"
			console.log(this.myname)
			console.log(this.name)
			setTimeout(() => {
				this.couponQrCode()
			}, 50)
		},
		methods: {
			// 二维码生成工具
			couponQrCode() {
				new qrCode('couponQrcode', {
					text: this.myname,
					width: 100,
					height: 100,
					colorDark: "#333333",
					colorLight: "#FFFFFF",
					correctLevel: qrCode.CorrectLevel.H
				})
			}
		}
	}
</script>

<style>
	.qrcode {
		padding: 50upx 0 20upx 0;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.title {
		text-align: center;
	}
</style>